import gradio as gr 
#import whisper
#from utils import translate
from functools import partial

output_types = ['txt','vtt','srt','json','tsv']
#model = whisper.load_model("medium")
#translate_to_srt = partial(translate, model=model)


block = gr.Blocks()

with block:
    gr.Markdown("#   视频配音")
    with gr.Row(): 
        with gr.Column() as col1:
            with gr.Blocks(): 
                with gr.Row():
                    inp_video = gr.Video(
                        label="输入视频"
                    )
                    op_audio = gr.Audio(
                        label="输入之前生成的配套音频"
                    )
            out_format = gr.CheckboxGroup(output_types,label="输出文本类型")
            out_format = gr.Dropdown(output_types,label="输出文本类型")
            tn = gr.Button("提取视频字幕")
            #btn.click(translate_to_srt, inputs=[inp_video,out_format], outputs=[op_video, op_text, op_audio]) 


        with gr.Column():
            '''
            with gr.Tab("字幕"):
                op_text = gr.Textbox(lines=11)
            '''
            op_video = gr.Video() 
            gr.Markdown("视频添加字幕")
            '''
            with gr.Tab("音频"):
                op_audio = gr.Audio()                    
            '''

if __name__ == "__main__":
    block.launch()  # debug = True

